﻿using GBlog.Core.Entities;
using System.Data.Entity;
namespace GBlog.Core.Mapping
{
    public class FileMap : MapBase<File, int>
    {
        public FileMap()
        {
            ToTable("Core_File");
            RegisterID();
            Property(t => t.FileName).IsRequired().HasMaxLength(64);
            Property(t => t.DownloadCount).IsRequired();
            HasRequired(t => t.FileType).WithMany().HasForeignKey(t => t.FileTypeID);
            HasRequired(t => t.Post).WithMany().HasForeignKey(t => t.PostID);
            RegisterDefault();
        }
    }
}